package com.tfswx.ruleengine.fn;

import com.greenpineyu.fel.context.FelContext;
import com.tfswx.ruleengine.compute.gzjy.BaseFn;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ricky
 * @date 2021/10/12
 */
public class Split extends BaseFn {
    @Override
    public Object call(Object[] arguments, FelContext context) {
        String str = String.valueOf(arguments[0]);
        String regex = String.valueOf(arguments[1]);
        return str.split(regex);
    }

    @Override
    public String getZwmc() {
        return "字符串分隔为数组";
    }


    @Override
    public String getName() {
        return "split";
    }


    @Override
    public List<Param> getParams() {
        List<Param> params = new ArrayList<>();
        params.add(new Param("str"));
        params.add(new Param("regex"));
        return params;
    }
}
